package cn.edu.scau.cmi.lvmingyan.abstractFactory.domain;

import java.net.URL;
import java.util.*;
import java.util.ResourceBundle;

import cn.edu.scau.cmi.lvmingyan.abstractFactory.factory.AbstractFactory;
import cn.edu.scau.cmi.lvmingyan.abstractFactory.factory.TianbangFactory;
import cn.edu.scau.cmi.lvmingyan.abstractFactory.factory.WensFactory;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;


public class MyController implements Initializable{
	@FXML
	private Button buy;
	@FXML
	private TextField brand;
	@FXML
	private TextField meat;
	@FXML
	private TextArea result;
	
	@Override
	public void initialize(URL location, ResourceBundle resources) {
	}
	
	public void OnClick(ActionEvent event) {
		String brandd=brand.getText();
		String meatt=meat.getText();
		/*if(meatt.equals("Beef")==false
				||meatt.equals("Chicken")==false||
				meatt.equals("Pork")==false)
		{
			result.setText("input error!");
			return;
		}*/
		AbstractFactory abstractFactory=null;
		Meat m=null;
		switch(brandd)
		{
		case "Wens": abstractFactory=new WensFactory();m=abstractFactory.create(meatt);break;
		case "Tianbang": abstractFactory=new TianbangFactory();m=abstractFactory.create(meatt);break;
		default:result.setText("input error!!!");return;
		}
		result.setText(m.play());
	}
}